﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using PMESqlOperator;
using SpreadSheetViewer.Models;

namespace SpreadSheetViewer.Service
{
    public class DataBaseController : Controller
    {
        public JsonResult GetSources()
        {
            SourceQuantityOperator dboperator = new SourceQuantityOperator();
            try
            {
                var res = dboperator.GetSources();
                return Json(res, JsonRequestBehavior.AllowGet);
            }
            catch(Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e);
                return null;
            }
        }
        public JsonResult GetQuantities()
        {
            SourceQuantityOperator dboperator = new SourceQuantityOperator();
            try
            {
                var res = dboperator.GetQuantities();
                return Json(res, JsonRequestBehavior.AllowGet);
            }
            catch(Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e);
                return null;
            }
        }
    }
}